package com.gzk.oeno.business.critere;

import com.gzk.oeno.business.INamed;
import com.gzk.oeno.business.ISortable;
import com.gzk.utils.data.IdObject;

public abstract class AbstractCritere implements IdObject<Integer>, INamed, ISortable{

	private Integer id;
	private String name;
	private Integer sortOrder;
	private AbstractCritere parent;
	
	public AbstractCritere(){}
	
	
	public AbstractCritere(String name, Integer sortOrder,
			AbstractCritere parent) {
		this.name = name;
		this.sortOrder = sortOrder;
		this.parent = parent;
	}


	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getSortOrder() {
		return sortOrder;
	}
	public void setSortOrder(Integer sortOrder) {
		this.sortOrder = sortOrder;
	}
	public AbstractCritere getParent() {
		return parent;
	}
	public void setParent(AbstractCritere parent) {
		this.parent = parent;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AbstractCritere other = (AbstractCritere) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
	
}
